﻿using System;
using System.Threading;
using Mono.Collections.Generic;

namespace Mono.Cecil
{
	// Token: 0x020000D4 RID: 212
	public sealed class InterfaceImplementation : ICustomAttributeProvider, IMetadataTokenProvider
	{
		// Token: 0x17000279 RID: 633
		// (get) Token: 0x0600088A RID: 2186 RVA: 0x00025068 File Offset: 0x00023268
		// (set) Token: 0x0600088B RID: 2187 RVA: 0x000052A2 File Offset: 0x000034A2
		public TypeReference InterfaceType
		{
			get
			{
				return this.interface_type;
			}
			set
			{
				this.interface_type = value;
			}
		}

		// Token: 0x1700027A RID: 634
		// (get) Token: 0x0600088C RID: 2188 RVA: 0x00025080 File Offset: 0x00023280
		public bool HasCustomAttributes
		{
			get
			{
				bool flag = this.custom_attributes != null;
				bool result;
				if (flag)
				{
					result = (this.custom_attributes.Count > 0);
				}
				else
				{
					bool flag2 = this.type == null;
					result = (!flag2 && this.GetHasCustomAttributes(this.type.Module));
				}
				return result;
			}
		}

		// Token: 0x1700027B RID: 635
		// (get) Token: 0x0600088D RID: 2189 RVA: 0x000250D4 File Offset: 0x000232D4
		public Collection<CustomAttribute> CustomAttributes
		{
			get
			{
				bool flag = this.type == null;
				Collection<CustomAttribute> result;
				if (flag)
				{
					bool flag2 = this.custom_attributes == null;
					if (flag2)
					{
						Interlocked.CompareExchange<Collection<CustomAttribute>>(ref this.custom_attributes, new Collection<CustomAttribute>(), null);
					}
					result = this.custom_attributes;
				}
				else
				{
					result = (this.custom_attributes ?? this.GetCustomAttributes(ref this.custom_attributes, this.type.Module));
				}
				return result;
			}
		}

		// Token: 0x1700027C RID: 636
		// (get) Token: 0x0600088E RID: 2190 RVA: 0x00025140 File Offset: 0x00023340
		// (set) Token: 0x0600088F RID: 2191 RVA: 0x000052AC File Offset: 0x000034AC
		public MetadataToken MetadataToken
		{
			get
			{
				return this.token;
			}
			set
			{
				this.token = value;
			}
		}

		// Token: 0x06000890 RID: 2192 RVA: 0x000052B6 File Offset: 0x000034B6
		internal InterfaceImplementation(TypeReference interfaceType, MetadataToken token)
		{
			this.interface_type = interfaceType;
			this.token = token;
		}

		// Token: 0x06000891 RID: 2193 RVA: 0x000052CE File Offset: 0x000034CE
		public InterfaceImplementation(TypeReference interfaceType)
		{
			Mixin.CheckType(interfaceType, Mixin.Argument.interfaceType);
			this.interface_type = interfaceType;
			this.token = new MetadataToken(TokenType.InterfaceImpl);
		}

		// Token: 0x0400033C RID: 828
		internal TypeDefinition type;

		// Token: 0x0400033D RID: 829
		internal MetadataToken token;

		// Token: 0x0400033E RID: 830
		private TypeReference interface_type;

		// Token: 0x0400033F RID: 831
		private Collection<CustomAttribute> custom_attributes;
	}
}
